
<template>

    <el-dialog
            :before-close="handleDialogClose"
            v-bind="$attrs"
            v-on="$listeners"
            @open="onOpen"
            title="删除提示"
            :close-on-click-modal="false"
            width="30%"
    >
        <span v-if="title==='区'||title==='块'||title==='环线'||title==='公交线'||title==='站点'">是否删除{{title}}<span class="del-desc">{{form.location_name}}</span>？确认删除后无法恢复。</span>


        <span v-if="title==='建筑'">是否删除建筑 <span class="del-desc">{{form.building_type_name}}</span>？确认删除后无法恢复。</span>
        <span v-if="title==='标签'">是否删除标签 <span class="del-desc">{{form.label_name}}</span>？确认删除后无法恢复。</span>
        <span v-if="title==='子栏目'">是否删除子栏目 <span class="del-desc">{{form.info_section_name}}</span>？确认删除后无法恢复。</span>
        <span v-if="title==='父栏目'">是否删除父栏目 <span class="del-desc">{{form.info_section_name}}</span>？确认删除后无法恢复。</span>
        <span slot="footer" class="dialog-footer">
    <el-button @click="cancel">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
    </el-dialog>


</template>

<script>
    export default {
        name: "SysConfigDel",
        props:['delDialogVisile','form','title','nowtype','drawUrl'],
        data(){
            return{
                delTitleMap:{
                        Area:{
                            area1DelTile:'区',
                            area2DelTile:'块',
                        },
                        Tranffic1:{
                            area1DelTile:'公交线',
                            area2DelTile:'站点',
                        },
                        TrafficBrt:{
                            area1DelTile:'公交线',
                            area2DelTile:'站点',
                        },
                    Building:{
                            area1DelTile:'建筑',

                        },
                    Property:{
                        area1DelTile:'物业',
                        area2DelTile:'标签',
                    },
                        Consulting:{
                            area1DelTile:'父栏目',
                            area2DelTile:'子栏目',
                        },

        },
            }},
        methods:{
            handleDialogClose(){
                this.$emit('onclose')
            },
            onOpen(){

            },
            cancel(){
                this.$emit('onclose')
            },


            submit(){
                // console.log('点击确认点击确认点击确认删除');
                //
                // console.log(this.form)
                // console.log(this.nowtype)
                // console.log({labelList:[this.form.label_id]})
                if (this.nowtype==='Area'){
                    // console.log(111111111)
                    // console.log(this.form.location_id)
                    this.delselectData([this.form.location_id])
                }
                if (this.nowtype==='Traffic1'){
                    // console.log('Traffic1删除')
                    // console.log([this.form.location_id])
                    this.delselectData({location_idList:[this.form.location_id],location_type:'轨道交通'})
                }
                if (this.nowtype==='TrafficBrt'){
                    // console.log('TrafficBrt删除')
                    // console.log([this.form.location_id])
                    this.delselectData({location_idList:[this.form.location_id],location_type:'BRT交通'})
                }
                if (this.nowtype==='LoopLine'){
                    this.delselectData({location_id:this.form.location_id})
                }
                if (this.nowtype==='Property'){
                    this.delselectData([this.form.label_id])
                }
                if (this.nowtype==='Building'){
                    this.delselectData({building_type_id:this.form.building_type_id})
                }
                if (this.nowtype==='Consulting'){
             /*       console.log([this.form.info_section_id])*/
                    this.delselectData([this.form.info_section_id])
                }

            },
            delselectData(id){
                // console.log('this.drawUrl')
                // console.log(this.drawUrl)
                // console.log(this.drawUrl.delurl)
                this.axios({
                    method:'post',
                    url:this.drawUrl.delurl,
                    data:id,
                }).then(data=>{
                    // console.log('返回')
                    // console.log(data)
                   if (data.data.code===200){
                       this.$message({
                           type:'success',
                           message:data.data.msg
                       });
                       this.$emit('onclose',true)
                   }
                   else {
                       this.$message({
                           type:'error',
                           message:data.data.msg
                       });
                   }
                })
            }
        },
        created() {
            // console.log(this.drawUrl)
        }
    }

</script>

<style lang="less" scoped>
.del-desc{
    margin: 0 6px;
    color: #ff690c;
    font-size: 16px;
}
</style>